#!perl -T

use Test::More tests => 4;

use Getopt::CommandLineExports qw(:ALL);

%cmdLines = (
    twoScalars      => [qw/ ONE=s TWO=s /],
    oneHash         => [qw/ ONE=s% /],
    oneList         => [qw/ ONE=s@ /],
);

sub twoScalars
{
    my %h = (
        ONE => undef,
        TWO => undef,
        ( parseArgs \@_, @{$cmdLines{twoScalars}}),
    );
    print "twoScalars missing required argument:\n"
        . join( "\n", checkArgs \%h ) . "\n"
        if ( checkArgs \%h );
    return " $h{ONE} , $h{TWO} \n";
}

sub oneHash
{
    my %h = (
        ONE => undef,
        ( parseArgs \@_, @{$cmdLines{oneHash}}),
    );
    print "oneHash missing required argument:\n"
        . join( "\n", checkArgs \%h ) . "\n"
        if ( checkArgs \%h );
    print "oneHash\n";
    print join("\n", (%{$h{ONE}}));
}

sub oneList
{
    my %h = (
        ONE => undef,
        ( parseArgs \@_, @{$cmdLines{oneList}}),
    );
    print "oneList missing required argument:\n"
        . join( "\n", checkArgs \%h ) . "\n"
        if ( checkArgs \%h );
    print "oneList\n";
    print join("\n",@{$h{ONE}});
}


like( (twoScalars "Hello1", "Hello2"), qr/Hello1.*Hello2/, 'Pass scalars by position');
like( (twoScalars {ONE => "Hello1", TWO => "Hello2"}), qr/Hello1.*Hello2/, 'Pass scalars by Name in hash');
like( (twoScalars "--ONE Hello1 --TWO Hello2") , qr/Hello1.*Hello2/, 'Pass scalars by Command Line String');
like( (twoScalars "--ONE", "Hello1", "--TWO", "Hello2") , qr/Hello1.*Hello2/, 'Pass scalars by Command Line ARGV String list');
#like( (twoScalars "--ONE", "Hello1", "--TWO", "Hello2", "--THREE", "Hello3"), qr/Hello1.*Hello2/, 'Pass scalars by Command Line ARGV String list with an unknown parameter');

